<?php
	$token = $_POST['token'];
	$tid = htmlentities(trim($_POST['tid']));
	$tName = trim($_POST['tName']);
	if(!$token || !$tid){
		exit('parm is miss !');
	}
	require '../autoload.php';

	//token验证
	if(!token_v('tabTypeDel',$token)){
		exit('token is error !');
	}

	$mp = new MyPdo();
	$sql = "delete from translate_type where id = ?";
	$arr = array($tid);
	$res = $mp->dml($sql,$arr);
	if($res){
		$sql = "delete from translate_info where typeid = ?";
		$res = $mp->dml($sql,$arr);



		if($res){
			echo 'tabTable or data to delete is success !';
		}else{
			echo 'tabTable delete is success ! but data is null or delete it is error !';
		}
		$sql = 'select id from translate_not_join where tid = ?';
		$res = $mp->dql($sql,array($tid));

		// $fileName = '../Runtime/Cache_long/'.md5($tid);
		// $content = file_get_contents($fileName);
		// $arr = unserialize($content);

		if(!$res){
			$dirs[] = '../Runtime/Cache_long/all';
		}
		$dirs[] = '../Runtime/Cache_long/indexButtonGroup_tabType';
		$dirs[] = '../Runtime/Cache_long/'.$tName;
		$dirs[] = '../Runtime/CacheInfoAll/'.$tName;
		$dirs[] = '../Runtime/CacheLefts/'.$tName;
		$dirs[] = '../Runtime/CacheRight/'.$tName;
		$dirs[] = '../Runtime/CacheLeftVague/'.$tName;
		$dirs[] = '../Runtime/CacheRightVague/'.$tName;
		foreach($dirs as $v){
			rmdirs($v);
		}


	}else{
		exit('type delete is error !');
	}

